home *** CD-ROM | disk | FTP | other *** search
- Path: EU.net!sun4nl!xs4all!falstaff
- From: falstaff@xs4all.nl (Falstaff)
- Newsgroups: comp.lang.c
- Subject: Re: goto
- Date: 15 Mar 1996 10:21:41 GMT
- Organization: XS4ALL, networking for the masses
- Message-ID: <4ibgbl$o8r@news.xs4all.nl>
- References: <Pine.OSF.3.91.960313102715.10701D-100000@io.UWinnipeg.ca> <wpmills.826820253@wpmills>
- NNTP-Posting-Host: xs1.xs4all.nl
- X-Newsreader: NN version 6.5.0 #666 (NOV)
-
- wpmills@midusa.net (W. Paul Mills) writes:
-
- >Bill Simpson <wsimpson@uwinnipeg.ca> writes:
-
- >>There was a goto thread lately, and my problem is to state this algorithm
- >>cleanly without gotos (which I think is easy, but my attempts have been
- >>failures).
-
- >>0. x=0;
- >>1. x+=erand(maxmean);
- >>2. if (urand2()>rate(x)/maxrate)
- >> goto step 1
- >>3. if (x<=XMAX)
- >> {
- >> setdot(x,y,z);
- >> goto step 1
- >> }
-
- >x = 0
- >do {
- > x += erand(maxmean);
- > if (urand2() > rate(x) / maxrate) continue;
- > setdot(x, y, z);
- > } while ( x < XMAX);
-
- No, this will call setdot() one time too much (when x>XMAX just before
- exiting the loop).
-
- Frank
- --
- The famous GIICM now on line: http://www.xs4all.nl/~falstaff/GIICM.html
- ------------------------------------------------------------------------
- Frank A. Vorstenbosch +31-(70)-355 5241 falstaff@xs4all.nl
-